
//
//  FZVistorController.swift
//  MyWeiBo
//
//  Created by fangzhengwei on 2017/3/27.
//  Copyright © 2017年 fangzhengwei. All rights reserved.
//

import UIKit

class FZVistorController: UITableViewController {

    var isLogin : Bool = FZUserViewModel.sharedUser.islogin
    var vistorView : FZVistorView?
        
    override func loadView() {
        
        if isLogin {
            
            super.loadView()
        }else{
            vistorView = FZVistorView()
            
            view = vistorView
            
            setupUI()
        }
    }
    
    func setupUI() {
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", target: self, selector: #selector(registAction))
        navigationItem.rightBarButtonItem =  UIBarButtonItem(title: "登陆", target: self, selector: #selector(loginAction))
        
        vistorView?.closure = { [weak self] in
            
            print("登陆")
            self?.enterOauth()
        }
        
        
    }

    func enterOauth() {
        
        let oAuthVC = FZOauthController()
        let nav = UINavigationController.init(rootViewController: oAuthVC)
        self.present(nav, animated: true, completion: nil)
        
    }
    func registAction() {
        print("登陆")
        self.enterOauth()
    }
    func loginAction() {
        
        print("登陆")
        self.enterOauth()
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }

    
   
}
